package com.example.zhugenew.adapter.newhouses;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.zhugenew.R;
import com.example.zhugenew.bean.newhouses.NewHouseEvidenceBean;

import java.util.ArrayList;
import java.util.List;

public class NewHouseEvidenceAdapter extends RecyclerView.Adapter<NewHouseEvidenceAdapter.ViewHolder> {
    private List<NewHouseEvidenceBean.DataBean> list;
    private Context context;

    public NewHouseEvidenceAdapter(List<NewHouseEvidenceBean.DataBean> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.layout_new_house_evidence_item, parent, false);
        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        holder.tv_text.setText(list.get(position).getCount() + "");
        Glide.with(context).load(list.get(position).getImgurl()).into(holder.imageView);
        holder.tv_yaohao.setText(list.get(position).getName());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        private TextView tv_text;
        private ImageView imageView;
        private TextView tv_yaohao;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            tv_text = itemView.findViewById(R.id.tv_lettory);
            imageView = itemView.findViewById(R.id.iv_lottery_newhouse);
            tv_yaohao = itemView.findViewById(R.id.tv_yaohao);
        }
    }
}
 